<template>
  <div class="left">
    <div v-for="(item, index) in list" :key="index" @click="fun(index)" :class="{ color: index == i }">
      {{ item.unit }}
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //   index: 0,
      i: 0
    };
  },
  mounted() {

  },
  methods: {
    fun(index) {
      //   this.index = index;
      this.i = index;
      this.$emit("onup", index);
    },
  },
  props: ["list"],
};
</script>

<style lang="scss" scoped>
.left {
  width: 80px;
  > .color {
    border-left: 3px solid red;
    margin: 40px 0;
    box-sizing: border-box;
  }
  > div {
    width: 100%;
    height: 50px;
    //   background-color: pink;
    margin: 5px 0;
    text-align: center;
    line-height: 50px;
    font-size: 12px;
    border-left: 3px solid transparent;
  }
}
</style>